<template>
	<svg class="icon" aria-hidden="true">
		<use :xlink:href="autoIcon"></use>
	</svg>
</template>

<script>
	/**
	 * @author wgm
	 * @description 阿里巴巴字体库
	 * https://www.iconfont.cn/manage/index?manage_type=myprojects&projectId=1039178
	 */
	import '@/assets/js/iconfont_symbol.js'

	export default {
		name    : "WIcon",
		props   : {
			icon: {
				type    : String,
				required: true
			}
		},
		computed: {
			//https://cn.vuejs.org/v2/api/#computed
			/*autoIcon() {
				return '#' + this.icon
			},*/
			autoIcon: {
				get() {
					return '#' + this.icon
				},
				/*set: function (v) {
					this.a = v - 1
				}*/
			}
		}
	}
</script>

<style lang="scss" scoped>
	//阿里巴巴字体库规定样式,必须这样写! 必须嘀!(东北发音)
	//https://www.iconfont.cn/help/detail?spm=a313x.7781069.1998910419.d8cf4382a&helptype=code
	.icon {
		width: 1em;
		height: 1em;
		vertical-align: -0.15em;
		fill: currentColor;
		overflow: hidden;
	}
</style>
